package com.gdust.gkyx.sys.controller;

import com.gdust.gkyx.common.result.Result;
import com.gdust.gkyx.model.sys.Region;
import com.gdust.gkyx.sys.service.RegionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName: RegionController
 * Package: com.gdust.gkyx.sys.controller
 * Description:地区表 前端控制器
 *
 * @Author syun
 * @Create 2025/1/24 13:54
 * @Version 1.0
 */
@Api(tags = "区域接口")
@RestController
@RequestMapping("/admin/sys/region")
//@CrossOrigin
public class RegionController {
    //注入地区表的service
    @Autowired
    private RegionService regionService;

    /**
     *     //根据区域关键字查询区域列表信息
     * //    url: `${api_name}/findRegionByKeyword/${keyword}`,
     * //    method: 'get'
     * @param keyword 关键字---地区名
     * @return
     */
    @ApiOperation("根据区域关键字查询区域列表信息")
    @GetMapping("findRegionByKeyword/{keyword}")
    public Result findRegionByKeyword(@PathVariable("keyword") String keyword) {
        List<Region> list = regionService.getRegionByKeyword(keyword);
        return Result.ok(list);
    }

}
